﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Default2 : System.Web.UI.Page
{
    delegate int AddOne(int i);
    delegate int ToAdd(int i, int j);
    delegate void Method1();
    delegate int Method2();

    protected void Page_Load(object sender, EventArgs e)
    {
        AddOne myAddOne;
        myAddOne = x => x + 1;//隐式类型,表达式方法体
        myAddOne = x => { return x + 1; };//隐式类型,语句方法体
        myAddOne = (int x) => x + 1;//显式类型,表达式方法体
        myAddOne = (int x) => { return x + 1; };//显式类型,语句方法体
        ToAdd myToAdd = (x, y) => x + y;//多个参数
        Method1 myMethod1 = () => Response.Write("myToAdd");//无参数,表达式方法体
        Method2 myMethod2 = () => 1;//无参数,语句方法体
    }
}
